<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
.lightbox {
	position: fixed;
	top: 0px;
	left: 0px;
	height: 100%;
	width: 100%;
	z-index: 7;
	opacity: 0.3;
	display: block;
	background-color: rgb(0, 0, 0);
	display: none;
}

.pop, iframe {
	position: absolute;
	left: 50%;
	top: 0;
	width: 893px;
	height: 100%;
	margin-left: -446.5px;
	z-index: 9;
}
</style>
<script src="/build/pdf.js"></script>
<script src="/build/jquery.min.js"></script>
</head>
<body>
	<ul>
		<li><a id="pdf"
			href="viewer.html?file=http://47.98.129.1:8080/source/http://47.98.129.1:8080/demo.pdf"
			target="pdfContainer" onclick="showPdf(true)">0001_pdf</a></li>
		<li><a href="viewer.html?name=b.pdf" target="pdfContainer"
			onclick="showPdf(true)">0002_pdf</a></li>
	</ul>
	<div class="lightbox" id="lightbox"></div>
	<div id="pop" class="pop" style="display: none;">
		<a href="javascript:close()"
			style="
		    position: absolute;
		    right: -90px;
		    display: inline-block;
		    width: 80px;
		    height: 30px;
		"
			id="close">关闭</a>
		<iframe src="" frameborder="0" id="pdfContainer" name="pdfContainer"></iframe>
	</div>

	<script type="text/javascript">
		//获取Location对象的search属性值  
		var searchStr = location.search;
		//由于searchStr属性值包括“?”，所以除去该字符  
		searchStr = searchStr.substr(1);
		//将searchStr字符串分割成数组，数组中的每一个元素为一个参数和参数值  
		var searchs = searchStr.split("&");
		//获得第一个参数和值  
		var address = searchs[0].split("=");
		if ((address[0]) == "url") {
			$("#pdf").attr("href", $("#pdf").attr("href").replace(/file(.*)source(.*)/g,"file=http://"+location.hostname+":"+location.port+"/source/"+address[1]));
		}
		function showPdf(isShow) {
			var state = "";
			if (isShow) {
				state = "block";
			} else {
				state = "none";
			}
			var pop = document.getElementById("pop");
			pop.style.display = state;
			var lightbox = document.getElementById("lightbox");
			lightbox.style.display = state;
		}
		function close() {
			showPdf(false);
		}
	</script>
</body>
</html>